package com.SoilMM.controller;


import com.SoilMM.entity.RtimeMonitEntity;
import com.SoilMM.service.RtimeMonitService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;


import org.springframework.web.bind.annotation.RestController;


import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Gramorgan
 * @since 2021-06-23
 */
@RestController
@RequestMapping("param")
public class RtimeMonitController {
    @Autowired
    private RtimeMonitService rtimeMonitService;
    @RequestMapping("rtime")
    public Map<String, Object> showRtimeParam(RtimeMonitEntity rtimeMonitEntity){
        System.out.println("/param/rtime/");
        return rtimeMonitService.showRtimeParam(rtimeMonitEntity);
    }
    @RequestMapping("/show")
    public Map<String,Object> show(int currentPage,int pageSize){
        Map<String,Object> map=new HashMap<>();

        Page page=new Page(currentPage,pageSize);

        IPage result=rtimeMonitService.page(page);


        if (result.getTotal()>0)
        {
            map.put("data",result);
            map.put("message","查询成功");
        }
        else {
            map.put("message","暂无数据");
        }

        return map;
    }

}

